import request from '@/utils/request';

/**
 * 编辑分类
 */
export async function editClassify(data) {
  const res = await request.post('/Classify/editClassify', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 添加分类
export async function addClassify(data) {
  const res = await request.post('/Classify/addClassify', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 打印机列表
export async function printerList(data) {
  const res = await request.post('/store/printerList', data);
  if (res.data.code === 0) {
    return res.data.data;
  }
  return Promise.reject(new Error(res.data.message));
}

// 添加打印机
export async function addPrinter(data) {
  const res = await request.post('/store/addPrinter', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 修改打印机
export async function editPrinter(data) {
  const res = await request.post('/store/editPrinter', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
//   打印小票
export async function printing(data) {
  const res = await request.post('/store/printing', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
// 删除打印机
export async function delPrinting(data) {
  const res = await request.post('/store/delPrinting', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.message));
}
